﻿﻿
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    application.setAttribute("rootpath", basePath);
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="${rootpath }"/>
    <title>客户关系管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"/>
    <link rel="bookmark" href="images/favicon.ico" type="image/x-icon"/>

    <link rel="stylesheet" type="text/css" href="js/easyui/main-layout.css"/>
    <link rel="stylesheet" type="text/css" href="js/easyui/themes/default/easyui.css" id="swicth-style"/>
    <script type="text/javascript" src="js/jquery-1.9.0.js"></script>
    <script type="text/javascript" src="js/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="js/easyui/easyui-messager.js"></script>

    <style type="text/css">
        .menu-bg, .top-bg, .welcome {
            background-color: #f6f5ec;
        }
    </style>
    <%@ include file="main-js.jsp" %>
</head>
<body class="easyui-layout">
<div region="north" border="true" class="cs-north">
    <div class="cs-north-bg top-bg">
        <div class="logo-title">客户关系管理系统</div>
        <div class="exit">
            <span style="color: black">欢迎您！
            <c:if test="${not empty sysUser}">
                ${sysUser.usrName}
            </c:if>！</span>
            <a href="javascript:logout()">退出系统</a></div>
    </div>
</div>
<div region="west" border="true" split="true" title="导航" class="cs-west">
    <div class="easyui-accordion" fit="true" border="false">
        <div title="客户管理" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="~cust/cust/list.jsp" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>客户信息管理</a></li>
                <li><a href="javascript:void(0);" src="~cust/lost/list.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>客户流失管理1</a></li>
            </ul>
        </div>
        <div title="营销管理" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="salc/scPage" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>销售机会管理</a></li>
                <li><a href="javascript:void(0);" src="~sale/dev.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>客户开发计划</a></li>
            </ul>
        </div>
        <div title="服务管理" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="~cust/service/add.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>服务创建</a></li>
                <li><a href="javascript:void(0);" src="~cust/service/dispatch.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>服务分配</a></li>
                <li><a href="javascript:void(0);" src="~cust/service/deal.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>服务处理</a></li>
                <li><a href="javascript:void(0);" src="~cust/service/feedback.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>服务反馈</a></li>
                <li><a href="javascript:void(0);" src="~cust/service/arch.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>服务归档</a></li>
            </ul>
        </div>
        <div title="统计报表" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="CstSustomer/selectContrBy" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>客户贡献分析</a></li>
                <li><a href="javascript:void(0);" src="CstSustomer/selectOrderBy?type=cust_level"
                       class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>客户构成分析</a></li>
                <li><a href="javascript:void(0);" src="~rept/ser.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>客户服务分析</a></li>
                <li><a href="javascript:void(0);" src="~rept/lost.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>客户流失分析</a></li>
            </ul>
        </div>
        <div title="数据字典管理" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="~basd/dict.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>数据字典</a></li>
            </ul>
        </div>
        <div title="用户管理" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="demo/regist.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>验证参考示例1</a></li>
                <li><a href="javascript:void(0);" src="demo/regist2.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>验证参考示例2</a></li>
                <li><a href="javascript:void(0);" src="demo/calendar.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>eayui日历的使用</a></li>
                <li><a href="javascript:void(0);" src="demo/messager.html" class="cs-navi-tab"><img
                        src="images/ns_doc.gif"/>自定义eayui消息框</a></li>
            </ul>
        </div>
    </div>
</div>
<div id="mainPanle" region="center" border="true" border="false">
    <div id="tabs" class="easyui-tabs" fit="true" border="false">
        <div title="Home" class="welcome">
            <div class="cs-home-remark">
                <img src="images/welcome.gif" alt=""/>
            </div>
        </div>
    </div>
</div>
<%--

<body class="easyui-layout" >
	<div region="north" border="true" class="cs-north">
		<div class="cs-north-bg top-bg">
			<div class="logo-title">客户关系管理系统</div>
			<div class="exit">
                <span style="color: black">欢迎您！
                <c:if test="${not empty sysUser}">
                    ${sysUser.usrName}
                </c:if>！</span>
                <a href="javascript:logout()">退出系统</a>
            </div>
		</div>
	</div>
	<div region="west" border="true" split="true" title="导航" class="cs-west">
		<div class="easyui-accordion" fit="true" border="false">
				<div title="客户管理" class="menu-bg">
				  <ul>
					<li><a href="javascript:void(0);" src="~cust/cust/list.html" class="cs-navi-tab"><img src="images/ns_doc.gif"/>客户信息管理</a></li>
				    <li><a href="javascript:void(0);" src="~cust/lost/list.html" class="cs-navi-tab"><img src="images/ns_doc.gif"/>客户流失管理</a></li>
				  </ul>
				</div>
				<div title="营销管理" class="menu-bg">
					<ul>
					  <li><a href="javascript:void(0);" src="salc/scPage" class="cs-navi-tab"><img src="images/ns_doc.gif"/>销售机会管理</a></li>
				      <li><a href="javascript:void(0);" src="~sale/dev.html" class="cs-navi-tab"><img src="images/ns_doc.gif"/>客户开发计划</a></li>
				    </ul>
				</div>
				<div title="服务管理" class="menu-bg">
				  <ul>
					<li><a href="javascript:void(0);" src="~cust/service/add.jsp" class="cs-navi-tab"><img src="images/ns_doc.gif"/>服务创建</a></li>
				    <li><a href="javascript:void(0);" src="CusService/selectService?path=dispatch" class="cs-navi-tab"><img src="images/ns_doc.gif"/>服务分配</a></li>
				    <li><a href="javascript:void(0);" src="~cust/service/deal.html" class="cs-navi-tab"><img src="images/ns_doc.gif"/>服务处理</a></li>
				    <li><a href="javascript:void(0);" src="CusService/selectService?path=feedback" class="cs-navi-tab"><img src="images/ns_doc.gif"/>服务反馈</a></li>
				    <li><a href="javascript:void(0);" src="CusService/selectService?path=arch" class="cs-navi-tab"><img src="images/ns_doc.gif"/>服务归档</a></li>
				  </ul>
				</div>
				<div title="统计报表" class="menu-bg">
				  <ul>
					<li><a href="javascript:void(0);" src="CstSustomer/selectContrBy" class="cs-navi-tab"><img src="images/ns_doc.gif"/>客户贡献分析</a></li>
				    <li><a href="javascript:void(0);" src="CstSustomer/selectOrderBy?type=cust_level" class="cs-navi-tab"><img src="images/ns_doc.gif"/>客户构成分析</a></li>
				    <li><a href="javascript:void(0);" src="~rept/ser.html" class="cs-navi-tab"><img src="images/ns_doc.gif"/>客户服务分析</a></li>
				    <li><a href="javascript:void(0);" src="~rept/lost.html" class="cs-navi-tab"><img src="images/ns_doc.gif"/>客户流失分析</a></li>
				  </ul>
				</div>
				<div title="数据字典管理" class="menu-bg">
				  <ul>
					<li><a href="javascript:void(0);" src="~basd/dict.html" class="cs-navi-tab"><img src="images/ns_doc.gif"/>数据字典</a></li>
				  </ul>
				</div>
				<div title="用户管理" class="menu-bg">
				  <ul>
				    <li><a href="javascript:void(0);" src="demo/regist.html" class="cs-navi-tab"><img src="images/ns_doc.gif"/>验证参考示例1</a></li>
				    <li><a href="javascript:void(0);" src="demo/regist2.html" class="cs-navi-tab"><img src="images/ns_doc.gif"/>验证参考示例2</a></li>
				    <li><a href="javascript:void(0);" src="demo/calendar.html" class="cs-navi-tab"><img src="images/ns_doc.gif"/>eayui日历的使用</a></li>
				    <li><a href="javascript:void(0);" src="demo/messager.html" class="cs-navi-tab"><img src="images/ns_doc.gif"/>自定义eayui消息框</a></li>
				 </ul>
				</div>
		</div>
	</div>
	<div id="mainPanle" region="center" border="true" border="false">
		 <div id="tabs" class="easyui-tabs"  fit="true" border="false" >
            <div title="Home" class="welcome">
				<div class="cs-home-remark">
					<img src="images/welcome.gif" alt="" />
				</div>
			</div>
        </div>
	</div>
<%--
	<div region="south" border="false" id="south"><center>@tianshaojie@foxmail.com</center></div>
--%>
<div id="mm" class="easyui-menu cs-tab-menu">
    <div id="mm-tabcloseother">关闭其他</div>
    <div id="mm-tabcloseall">关闭全部</div>
</div>

<script>
    $(function () {
        $.ajax({
            url: '/user/getPriviege',
            type: 'get',
            dataType: 'json',
            success: function (list) {
                rolemenu(list);
            },
            error: function (list) {
                window.location.href = "login.jsp";
            }
        })
        /*var roles = [{priv_id: 1, priv_name: "xxx", uri: "xxxx", prend_id: 0},
            {priv_id: 2, priv_name: "xxx", uri: "xxxx", prend_id: 0},
            {priv_id: 3, priv_name: "xxx", uri: "xxxx", prend_id: 0},
            {priv_id: 8, priv_name: "xxx", uri: "xxxx", prend_id: 1},
            {priv_id: 9, priv_name: "xxx", uri: "xxxx", prend_id: 2},
            {priv_id: 13, priv_name: "xxx", uri: "xxxx", prend_id: 3},];*/

        function rolemenu(roles) {
            var menu = $(".accordion .panel");
            for (var i = 0; i < menu.length; i++) {
                var flag = 0;
                for (var j = 0; j < roles.length; j++) {
                    if ((i + 1) == roles[j].priv_id && roles[j].prend_id == 0) {
                        flag = 1;
                        break;
                    }
                }
                if (flag == 1) {
                    var duct = 6;
                    if (i == 0) duct = 7;
                    if (i == 1) duct = 9;
                    if (i == 2) duct = 11;
                    if (i == 3) duct = 16;
                    if (i == 4) duct = 20
                    var li = $(menu[i]).find("li");
                    for (var k = 0; k < li.length; k++) {
                        var lifalg = 0;
                        for (var j = 0; j < roles.length; j++) {
                            if (k == (roles[j].priv_id - duct)) {
                                lifalg = 1;
                                break;
                            }
                        }
                        if (lifalg == 0) {
                            $(li[k]).hide();
                        }
                    }
                }
                if (flag == 0) {
                    $(menu[i]).hide();
                }
            }
        }
    })
</script>
</body>
</html>
